import Vue from 'vue'
import VueRouter from 'vue-router'

// 引入第一级路由
import Collect from '@/views/collect.vue'
import Layout from '@/views/layout.vue'
import Login from '@/views/login.vue'
import Register from '@/views/register.vue'

// 引入二级路由
import LayoutHome from '@/page/Layout-Home.vue'
import LayoutFind from '@/page/Layout-Find.vue'
import LayoutMessage from '@/page/Layout-Message.vue'
import LayoutUser from '@/page/Layout-User.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/collect',
    component: Collect
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/register',
    component: Register
  },
  {
    path: '/',
    component: Layout,
    redirect: '/Layout-Home',
    children: [
      {
        path: '/Layout-Home',
        component: LayoutHome

      },
      {
        path: '/Layout-Find',
        component: LayoutFind

      },
      {
        path: '/Layout-Message',
        component: LayoutMessage

      },
      {
        path: '/Layout-User',
        component: LayoutUser

      }
    ]

  }

]

const router = new VueRouter({
  routes
})

export default router
